package com.example.testdemo.video_progress;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.View;

import com.example.testdemo.R;

/**
 * Created by 颜 on 04.18.018.
 * VideoProgress
 */

public class VideoProgressActivity extends Activity {
    private int progress;
    private VideoProgressBar videoProgressBar;
    private DouYinBar douYinBar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_progress);
        videoProgressBar = findViewById(R.id.videoProgressBar);
        douYinBar = findViewById(R.id.douYinBar);
        videoProgressBar.setDuration(3000);
        douYinBar.setDuration(3000);
    }

    public void addProgress(View view) {
        videoProgressBar.setShowProgress(progress += 100);
        douYinBar.setProgress(progress);
    }

    public void caching(View view) {
        progress = 0;
        videoProgressBar.setShowProgress(progress);
        douYinBar.setStatus(DouYinBar.STATUS_BUFFER_ING);
    }


    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        return douYinBar.onKeyDown(keyCode,event);
    }
}
